package com.itheima.controller;

import com.itheima.common.GlobalConstant;
import com.itheima.common.R;
import com.itheima.entity.Orders;
import com.itheima.service.IOrdersService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 订单表控制器
 *
 * @author hua
 * @since 2022/11/7 18:09
 */
@Slf4j
@RestController
@RequestMapping("/order")
public class OrdersController {
    @Autowired
    private IOrdersService orderService;
    //1. 请求路径
    //2. 请求方式
    //3. 请求参数
    //4. 返回值
@PostMapping("/submit")
    public R<String> submit(@RequestBody Orders orders){
    log.info("前后端连通");
    //在service中扩展方法
    this.orderService.submit(orders);
    return R.success(GlobalConstant.SUCCESS);
}
}
